<template>
    <div>
        <div v-show="this.pageOne">
            <Row>
                <new-car-detail ref="newCarDetail" @isChange="isChange" :apply-no="this.applyNumber" :is-check="isCheck" v-on:function="showCarStyleDetailInfo" v-on:maxLoan="updateTotalLoanAmtInfo" ></new-car-detail>
            </Row>
        </div>
        <div v-show="this.pageTwo">
            <Row>
                <old-car-detail ref="oldCarDetail" :apply-no="this.applyNumber" :is-check="isCheck" v-on:function="showCarStyleDetailInfo"  v-on:maxLoan="updateTotalLoanAmtInfo"></old-car-detail>
            </Row>
        </div>
        <div v-show="this.pageThree">
            <Row>
                <plate-car-detail ref="plateCarDetail" :apply-no="this.applyNumber" :is-check="isCheck" v-on:function="showCarStyleDetailInfo"></plate-car-detail>
            </Row>
        </div>
        <div>

            <Modal title="车辆配置参数" v-model="carStyleDetail" scrollable footer-hide :width="400" :styles="{top: '10px'}">
                <Form ref="carStyleInfo" :model="carStyleInfo" disabled :label-width="150">
                    <FormItem label="排放标准" prop="emissionStandard">
                        <Input v-model="carStyleInfo.emissionStandard" />
                    </FormItem>
                    <FormItem label="排量（L）" prop="displacement">
                        <Input v-model="carStyleInfo.displacement" />
                    </FormItem>
                    <FormItem label="最大马力" prop="maxPower">
                        <Input v-model="carStyleInfo.maxPower" />
                    </FormItem>
                    <FormItem label="燃料种类" prop="fuelType">
                        <Input v-model="carStyleInfo.fuelType" />
                    </FormItem>
                    <FormItem label="类型" prop="type">
                        <Input v-model="carStyleInfo.type" />
                    </FormItem>
                    <FormItem label="车身宽度（米）" prop="carWidth">
                        <Input v-model="carStyleInfo.carWidth" />
                    </FormItem>
                    <FormItem label="车身长度（米）" prop="carLength">
                        <Input v-model="carStyleInfo.carLength" />
                    </FormItem>
                    <FormItem label="车身高度（米）" prop="carHeight">
                        <Input v-model="carStyleInfo.carHeight" />
                    </FormItem>
                    <FormItem label="轴距（mm）" prop="wheelbase">
                        <Input v-model="carStyleInfo.wheelbase" />
                    </FormItem>
                    <FormItem label="额定载重（吨）" prop="ratedLoad">
                        <Input v-model="carStyleInfo.ratedLoad" />
                    </FormItem>
                    <FormItem label="驱动形式" prop="driveForm">
                        <Input v-model="carStyleInfo.driveForm" />
                    </FormItem>
                    <FormItem label="货箱宽度（米）" prop="boxWidth">
                        <Input v-model="carStyleInfo.boxWidth" />
                    </FormItem>
                    <FormItem label="货箱形式" prop="boxLength">
                        <Input v-model="carStyleInfo.boxLength" />
                    </FormItem>
                    <FormItem label="货箱长度（米）" prop="boxHeight">
                        <Input v-model="carStyleInfo.boxHeight" />
                    </FormItem>
                    <FormItem label="货箱高度（米）" prop="boxForm">
                        <Input v-model="carStyleInfo.boxForm" />
                    </FormItem>
                    <FormItem label="轮胎数" prop="tireNumber">
                        <Input v-model="carStyleInfo.tireNumber" />
                    </FormItem>
                    <FormItem label="准乘人数" prop="passengers">
                        <Input v-model="carStyleInfo.passengers" />
                    </FormItem>
                    <FormItem label="座位排数" prop="seatRows">
                        <Input v-model="carStyleInfo.seatRows" />
                    </FormItem>
                    <FormItem label="发动机" prop="engine">
                        <Input v-model="carStyleInfo.engine" />
                    </FormItem>
                    <FormItem label="发动机形式" prop="engineForm">
                        <Input v-model="carStyleInfo.engineForm" />
                    </FormItem>
                    <FormItem label="最大输出功率（kW）" prop="maxOutPower">
                        <Input v-model="carStyleInfo.maxOutPower" />
                    </FormItem>
                    <FormItem label="倒挡数" prop="reverseGearNumber">
                        <Input v-model="carStyleInfo.reverseGearNumber" />
                    </FormItem>
                    <FormItem label="前进挡位数" prop="forwardGearNumber">
                        <Input v-model="carStyleInfo.forwardGearNumber" />
                    </FormItem>
                    <FormItem label="换挡方式" prop="shiftMethod">
                        <Input v-model="carStyleInfo.shiftMethod" />
                    </FormItem>
                    <FormItem label="产地" prop="origin">
                        <Input v-model="carStyleInfo.origin" />
                    </FormItem>
                    <FormItem label="前轮距" prop="frontTrack">
                        <Input v-model="carStyleInfo.frontTrack" />
                    </FormItem>
                    <FormItem label="后轮距" prop="rearTrack">
                        <Input v-model="carStyleInfo.rearTrack" />
                    </FormItem>
                    <FormItem label="吨位级别" prop="tonnageClass">
                        <Input v-model="carStyleInfo.tonnageClass" />
                    </FormItem>
                    <FormItem label="总质量（吨）" prop="totalQuality">
                        <Input v-model="carStyleInfo.totalQuality" />
                    </FormItem>
                    <FormItem label="整车质量（吨）" prop="vehicleQuality">
                        <Input v-model="carStyleInfo.vehicleQuality" />
                    </FormItem>
                    <FormItem label="最高车速（km/h）" prop="maxSpeed">
                        <Input v-model="carStyleInfo.maxSpeed" />
                    </FormItem>
                    <FormItem label="生产厂家" prop="manufacturer">
                        <Input v-model="carStyleInfo.manufacturer" />
                    </FormItem>
                </Form>
            </Modal>
        </div>
    </div>
</template>

<script>
    import {
        queryCarSummaryInfo,
        queryCarStyleDetailInfo
    } from "@/projects/afs-core-business/api/afs-case/infomationDetail/carDetail";
    import newCarDetail from "../car/newCarDetail.vue";
    import oldCarDetail from "../car/oldCarDetail.vue";
    import plateCarDetail from "../car/plateCarDetail.vue";
    export default {
        name: "car-detail",
        components: {
            newCarDetail,
            oldCarDetail,
            plateCarDetail
        },
        props: {
            applyNo: {
                type: String,
                required: true
            },
            isCheck: {
                type: Boolean
            }
        },
        data:function () {
            return {
                applyNumber:this.applyNo,
                carStyleDetail: false,
                pageOne:false,
                pageTwo:false,
                pageThree:false,
                dataDic:{},
                pageInfo:{},
                carStyleInfo:{},
            }
        },
        methods:{
            updateTotalLoanAmt(loanAmtMax){
                this.$emit('maxLoanInfo',loanAmtMax);
            },
            showCarStyleDetailInfo(carId){
                let params = {
                    carId: carId
                }
                queryCarStyleDetailInfo(params).then(res => {
                    if (res.code === "0000") {
                        this.carStyleInfo = res.data;
                    }
                });
                this.carStyleDetail = true;
            },
            updateTotalLoanAmtInfo(loanAmtMax){
                this.updateTotalLoanAmt(loanAmtMax);
            },
            isChange() {
                this.$emit('isDeal')
            },
            initInfo(){
                let params = {
                    applyNo: this.applyNumber
                }
                queryCarSummaryInfo(params).then(res => {
                    if (res.code === "0000") {
                        this.pageInfo = res.data;
                        this.pageOne = this.pageInfo.pageOne;
                        this.pageTwo = this.pageInfo.pageTwo;
                        this.pageThree = this.pageInfo.pageThree;
                    }
                });
            },
            init() {
                this.initInfo();
            },
        },
        mounted() {
            this.init();
        }
    }
</script>

<style scoped>

</style>
